package com.guijq.qlcoderperktree.rest;

import java.util.HashSet;
import java.util.Set;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author yangjf
 * @version 0.1.0
 * @time 2018/10/23/023
 */
@RestController
public class HelloController {
    Set<String> userSet = new HashSet<>();

    @RequestMapping(value = "/guijq2", method = RequestMethod.GET)
    public int test(@RequestParam Integer a, @RequestParam Integer b) {
        return a * b;
    }

    @RequestMapping(value = "/guijq3", method = RequestMethod.GET)
    public String test(@RequestParam String registerusername) {
        if (userSet.contains(registerusername)) {
            return "already used";
        }else {
            userSet.add(registerusername);
            return "register success";
        }
    }
}
